#include <bits/stdc++.h>
using namespace std;
const int N=1e5;
typedef long long ll;

void solve()
{
	int a,b;
	cin>>a>>b;
	cout<<a<<" "<<b<<'\n'; 
	cout<<__gcd(a,b)<<'\n';
}

int main()
{
	solve();
	
	
	return 0;
}
